//
//  main.c
//  Questions
//
//  Created by wangrui.
//  Copyright (c) 2014年 wangrui. All rights reserved.
//

/*
 *二分图最大分配
 *
 *2014-10-10 17:48:36
 *测试数据:
	6 5
	1 4
	1 5
	2 5
	2 6
	3 4
 */

#include <stdio.h>
#include <stdlib.h>
#include "cutils.h"

#ifdef DEBUG
#undef DEBUG
#define DEBUG 1
#endif

#define MaxSize 10
int match[MaxSize];
int flag[MaxSize];

int e[MaxSize][MaxSize];//邻接矩阵
int n,m;

int dfs(int u)
{
	for (int i=0; i<=n; i++) {
		
		if ( flag[i]==0 && e[u][i] == 1) {
			
			flag[i] = 1;
			
			if (match[i]==0 || dfs(match[i])) {//i 未被配对或者找到了新的配对(找增广路)
				
				match[i] = u;
				match[u] = i;
				
				return 1;
			}
		}
	}
	
	return 0;
}

int main(int argc, const char * argv[])
{
	scanf("%d %d",&n,&m);
	
	for (int i=1; i<=n; i++) {
		for (int j=0; j<=n; j++) {
			e[i][j] = 0; //0表示不连通
		}
	}
	
	for (int i=1; i<=m; i++) {
		int x,y;
		scanf("%d %d",&x,&y);
		e[x][y] = 1;
		e[y][x] = 1;
	}
	
	int sum = 0;
	
	for (int i=1; i<=n; i++) {
		
		for (int i=1; i<=n; i++) {//清空搜索标记
			flag[i] = 0;
		}
		
		if (dfs(i)) {
			sum++;
		}
	}
	
	printf("%d \n",sum);
	
	return 0;
}


